﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<WRSManagementSystem.DomainModel.Entities.Task>>" %>

<%@ Import Namespace="WRSManagementSystem.DomainModel.Entities" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Zadania
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Zadania</h2>
    <table>
        <tr>
            <th>
            </th>
            <th>
                Nazwa
            </th>
            <th>
                Opis
            </th>
            <th>
                Początek
            </th>
            <th>
                Koniec
            </th>
            <th>
                Aktywne
            </th>
        </tr>
        <%
            foreach (Task item in Model)
            {%>
        <tr>
            <td>
                <%=Html.ActionLink("Edytuj", "../Task/Edit", new {id = item.Id})%>
                |
                <%=Html.ActionLink("Szczegóły", "../Task/Details", new {id = item.Id})%>
            </td>
            <%--   <td>
                <%= Html.Encode(item.Id) %>
            </td>--%>
            <td>
                <%=Html.Encode(item.Name)%>
            </td>
            <td>
                <%=Html.Encode(item.Description)%>
            </td>
            <td>
                <%=Html.Encode(String.Format("{0:g}", item.StartDate))%>
            </td>
            <td>
                <%=Html.Encode(String.Format("{0:g}", item.EndDate))%>
            </td>
            <td>
                <%=Html.Encode(item.IsActive)%>
            </td>
        </tr>
        <%
            }%>
    </table>
    <p>
        <%=Html.ActionLink("Nowe zadanie", "../Task/Create")%>
    </p>
    <fieldset>
        <legend>Raporty</legend>
        <% using (Html.BeginForm("Report", "Task")) %>
        <% { %>
        <div class="editor-label">
            <%=Html.Label("Nieukończone zadania mające zakończyć się przed:")%>
        </div>
        <div class="editor-field">
            <% System.DateTime now = System.DateTime.Now; %>
            <%= Html.DatePicker( "Deadline", Html.Encode(String.Format("{0:00}/{1:00}/{2:0000}",now.Month,now.Day,now.Year)) ) %>
        </div>
        <br />
        <input type="submit" value="Pokaż" />
        <% } %>
    </fieldset>
</asp:Content>
